package com.example.hellospringboot.controller;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
public class HelloController {
    static private HashMap<String,Integer> mmap = new HashMap<>();
    @GetMapping("/hello")
    public String hello(){
        return "Hello Springboot.mmap:"+mmap ;
    }

    @PostMapping("/hello")
    public String hello(String name,int age){
        mmap.put(name,age);
        return "post[=add,create] name: " + name +",age" + age;
    }

    @PutMapping("/hello")
    public String helloPut(String name,int age){
        mmap.replace(name,age);
        return "update name:" + name +",age=+" + age ;
    }

    @DeleteMapping("hello/{name}")
    public String helloDel(@PathVariable String name){
        mmap.remove(name);
        return "delete name :" + name;
    }

}
